package com.mazaiting.manager.controller;

import com.mazaiting.common.core.ex.exceptions.EmptyObjectException;
import com.mazaiting.manager.dto.SysOauthClientDTO;
import com.mazaiting.manager.service.ISysOauthClientService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 认证客户端控制器
 *
 * @author mazaiting
 * @since 2022-09-17
 */
@Slf4j
@RestController
@RequestMapping("manager/v1/oauth2Client")
@RequiredArgsConstructor
public class SysOauthClientController {

    private final ISysOauthClientService sysOauthClientService;

    /**
     * 根据客户端 ID 获取客户端
     * @param clientId 客户端 ID
     * @return 认证客户端信息
     */
    @GetMapping("getOAuth2ClientById")
    public SysOauthClientDTO getOAuth2ClientById(@RequestParam String clientId) throws EmptyObjectException {
        return sysOauthClientService.getOauth2ClientById(clientId);
    }


}
